---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: {{ minikube_service_account_name }}
  namespace: {{ minikube_service_account_namespace }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: {{ minikube_service_account_name }}
  namespace: {{ minikube_service_account_namespace }}
rules:
- apiGroups: [""] # "" indicates the core API group
  resources: ["pods"]
  verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
- apiGroups: [""]
  resources: ["pods/log"]
  verbs: ["get"]
- apiGroups: [""]
  resources: ["pods/attach"]
  verbs: ["create"]
- apiGroups: [""]
  resources: ["secrets"]
  verbs: ["get", "create", "delete"]
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: RoleBinding
metadata:
  name: {{ minikube_service_account_name }}
  namespace: {{ minikube_service_account_namespace }}
subjects:
- kind: ServiceAccount
  name: {{ minikube_service_account_name }}
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: {{ minikube_service_account_name }}
